package com.google.code

object Comment {
  def apply(body:String, parent: Option[Node]) = new Comment(body, parent)
}

class Comment(body: String, val parent: Option[Node]) extends XmlNode {
  override val children = Nil

  override def foldLeft[T](initial: T)(f: (T, XmlNode) => T): T = f(initial, this)
  override def \(name:String): Option[XmlNode] = None
  override def \\(name: String): List[XmlNode] = Nil

  override def changeParent(newParent: Option[Node]): Comment =
    Comment(body, newParent)

  override def toString = s"<!-- {$body} -->"
}
